#include "stare.h"
#include "ui_stare.h"
#include <QtCore/QDebug>
#include "mainwindow.h"
#include <QtWidgets>
#include <QAbstractItemView>
#include<QLineEdit>
#include <QMessageBox>
#include<QtWidgets>

Stare::Stare(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Stare)
{
    ui->setupUi(this);
    ui->Production_quantity->setPlaceholderText("Search...");
    ui->input_password->setPlaceholderText("Please  password...");
    //ui->Sn_number->setPlaceholderText("Please SN...");
   // ui->Sn_number->setEnabled(false);
    ui->input_password->setEchoMode(QLineEdit::Password);

}

Stare::~Stare()
{
    delete ui;
}
void    Stare::fall(int    PASS)
{
float   Number  =   0.0;
Number  =   Number+PASS;
QString strname =  ui->Production_quantity->text();
 decsum =   strname.toLong();
float pass_number =   Number/decsum;
ui->fall->setText(QString::number(pass_number));
//ui->fall->QColor(115,210,22);
}
void    Stare::pass(int pass)
{
    float   NUmber  =   0.0;
    NUmber  =   NUmber+pass;
    QString Strname =  ui->Production_quantity->text();
     Decsum =   Strname.toLong();
    float Pass_number =   NUmber/Decsum;
    ui->pass->setText(QString::number(Pass_number));

}

void Stare::on_Cleardate_clicked()
{
QString password =  ui->input_password->text();
if(password==tr("168169"))
{
ui->pass->clear();
ui->fall->clear();
ui->Production_quantity->clear();
ui->Production_quantity->setEnabled(true);
}
else
{

    QMessageBox::warning(this, tr("About Simple Terminal"),
                       tr("Enter    password    error......168169"),QMessageBox::Yes);
}
ui->input_password->clear();
}
void Stare::on_Save_clicked()
{
    ui->Production_quantity->setEnabled(false);
}
